﻿
namespace CookPlan.ViewModel
{
    using System;
    using System.Collections.ObjectModel;
    using System.Windows.Input;

    using CookPlan.Command;
    using CookPlan.Model;

    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Controls;

    /// <summary>
    /// TODO 
    /// </summary>
    public class MainPageViewModel : ViewModelBase
    {
        private ICommand searchCommand;

        public Collection<string> MenuPoint { get; set; }

        public Collection<string> DishType { get; set; }

        public Collection<string> Countrys { get; set; }

        public Collection<string> Preparation { get; set; }

        public ICommand SearchCommand
        {
            get
            {
                return this.searchCommand;
            }
        }

        /// <summary>
        /// TODO
        /// </summary>
        public MainPageViewModel()
        {
            this.searchCommand = new ActionCommand { ActionHandler = this.OnSeachCommandExecute };

            this.MenuPoint = new Collection<string>();
            this.DishType = new Collection<string>();
            this.Countrys = new Collection<string>();
            this.Preparation = new Collection<string>();

            this.MenuPoint.Add("Vorspeise");
            this.MenuPoint.Add("Hauptspeise");
            this.MenuPoint.Add("Beilage");
            this.MenuPoint.Add("Süße Hauptspeise");
            this.MenuPoint.Add("Nachtisch / Dessert");
            this.MenuPoint.Add("Getränke");
            this.MenuPoint.Add("Party");
            this.MenuPoint.Add("Brunch / Frühstück");
            this.MenuPoint.Add("Kinderrezepte");

            this.DishType.Add("Auflauf/Überbackenes");
            this.DishType.Add("Braten (Fleisch)");
            this.DishType.Add("Brot/Brötchen");
            this.DishType.Add("Dips/Cremes");
            this.DishType.Add("Eingemachtes");
            this.DishType.Add("Eisspeise/Halbgefrorenes");
            this.DishType.Add("Fingerfood/Snack");
            this.DishType.Add("Konfekt/Süßware");
            this.DishType.Add("Kuchen/Torte");
            this.DishType.Add("Pfannkuchen/Crêpe");
            this.DishType.Add("Pikante Kuchen/Pizza");
            this.DishType.Add("Plätzchen/Kekse");
            this.DishType.Add("Pudding/Cremes");
            this.DishType.Add("Salate");
            this.DishType.Add("Sandwiches/Brote");
            this.DishType.Add("Suppen/Eintöpfe");
            this.DishType.Add("Würzmittel/Marinade");

            this.Countrys.Add("Afrikanisch");
            this.Countrys.Add("Asiatisch");
            this.Countrys.Add("Britisch");
            this.Countrys.Add("Chinesisch");
            this.Countrys.Add("Deutsch");
            this.Countrys.Add("Französisch");
            this.Countrys.Add("Griechisch");
            this.Countrys.Add("Italienisch");
            this.Countrys.Add("Japanisch");
            this.Countrys.Add("Kreolisch");
            this.Countrys.Add("Österreichisch");
            this.Countrys.Add("Orientalisch");
            this.Countrys.Add("Osteuropäisch");
            this.Countrys.Add("Portugiesisch");
            this.Countrys.Add("Skandinavisch");
            this.Countrys.Add("Spanisch");
            this.Countrys.Add("Südamerikanisch");
            this.Countrys.Add("Thailändisch");
            this.Countrys.Add("US-Amerikanisch");

            this.Preparation.Add("Backen");
            this.Preparation.Add("Blanchieren");
            this.Preparation.Add("Braten");
            this.Preparation.Add("Dämpfen");
            this.Preparation.Add("Dünsten");
            this.Preparation.Add("Einmachen");
            this.Preparation.Add("Frittieren");
            this.Preparation.Add("Einfrieren");
            this.Preparation.Add("Gratinieren/Überbacken");
            this.Preparation.Add("Grillen");
            this.Preparation.Add("Backen");
            this.Preparation.Add("Kochen");
            this.Preparation.Add("Pochieren");
            this.Preparation.Add("Schmoren");
        }

        private void OnSeachCommandExecute()
        {
            // Create a Frame to act navigation context and navigate to the first page
            var rootFrame = new Frame();
            if (!rootFrame.Navigate(typeof(SearchResult)))
            {
                throw new Exception("Failed to create initial page");
            }

            // Place the frame in the current Window and ensure that it is active

            Window.Current.Content = rootFrame;
            Window.Current.Activate();
        }
    }
}
